﻿using System;
using System.Globalization;
using System.Threading;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using UCOLOR.Helpers;
using UCOLOR.View;
using UCOLOR.ViewModel;
using DevExpress.Utils;
using DevExpress.Xpf.Core;
using System.Windows.Controls;
using UCOLOR.Data;
namespace UCOLOR.Model
{
    public class PhotoInfo
    {
        public ImageSource Source { get; set; }
        public string Caption { get; set; }
        public string SizeInfo { get; set; }
        public Size ViewSize { get; set; }
        public PhotoInfo()
        {
            ViewSize = new Size(double.NaN, double.NaN);
        }
    }
    public class ImageModel : BaseModel
    {
        static ImageModel()
        {
            string v = DataHelper.GetParameterInfo("IMAGE_PIXEL");
            if (string.IsNullOrEmpty(v))
                return;
            ZoomHeight = int.Parse(v);
        }
        public static int ZoomHeight = 200;
        public int ImageWidth
        {
            get;
            set;
        }
        public int ImageHeight
        {
            get;
            set;
        }
        private int _ImageZoomWidth;
        public int ImageZoomWidth
        {
            get
            {
                if (PhotoSource == null)
                    return 200;
                else
                    return _ImageZoomWidth;
            }
            set
            {
                _ImageZoomWidth = value;
            }
        }
        private int _ImageZoomHeight;
        public int ImageZoomHeight
        {
            get
            {
                if (PhotoSource == null)
                    return 200;
                else
                    return _ImageZoomHeight;
            }
            set
            {
                _ImageZoomHeight = value;
            }
        }

        public string file_name
        {
            get;
            set;
        }
        public string description
        {
            get;
            set;
        }
        public ImageSource PhotoSource
        {
            get
            {
                ImageSource phSrc= string.IsNullOrEmpty(file_name) ? null : ImageSourceHelper.GetImageSource(DataHelper.GetIMAGE_ROOT() + file_name);
                if (phSrc != null)
                {
                    BitmapImage bi = phSrc as BitmapImage;
                    ImageWidth = bi.PixelWidth;
                    ImageHeight = bi.PixelHeight;
                    float zoom = (float)ImageHeight / (float)ZoomHeight;
                    ImageZoomHeight = ZoomHeight;
                    ImageZoomWidth = (int)((float)ImageWidth / zoom);
                }
                return phSrc;
            }
        }
    }
    #region 获取数据 
    public class ClientMessage : BaseModel
    {

        public string message_type
        {
            get;
            set;
        }

        public string item_seq_no
        {
            get;
            set;
        }

        public string message_text
        {
            get;
            set;
        }

        public DateTime date_received
        {
            get;
            set;
        }

        public string option_type
        {
            get;
            set;
        }
    }


    public class ExhibitionGroupItem : ImageModel
    {
        public string group_id
        {
            get;
            set;
        }

        public string item_no
        {
            get;
            set;
        }
       
       
        public string catalog_no
        {
            get;
            set;
        }
        public string product_code
        {
            get;
            set;
        }

        public string product_family
        {
            get;
            set;
        }

       
    }

    public class ExhibitionGroup : BaseModel
    {
        public string group_id
        {
            get;
            set;
        }

        public string group_desc
        {
            get;
            set;
        }


        public string pieces_x
        {
            get;
            set;
        }


        public string pieces_y
        {
            get;
            set;
        }


        public string group_type
        {
            get;
            set;
        }


        public string message_text
        {
            get;
            set;
        }

        public int sort_seq
        {
            get;
            set;
        }

      
    }


    public class PartProductCode : ImageModel
    {
        public string product_code
        {
            get;
            set;
        }

       
        public string note_text
        {
            get;
            set;
        }

       
    }

    public class PartProductFamily : ImageModel
    {
        public string product_family
        {
            get;
            set;
        }

        public string product_code
        {
            get;
            set;
        }

       

        public string note_text
        {
            get;
            set;
        }

       
    }

    public class SalesCatalogTemplate : BaseModel
    {
        public int template_id
        {
            get;
            set;
        }

        public string catalog_no
        {
            get;
            set;
        }

        public string note_text
        {
            get;
            set;
        }
    }

    public class SalesPartAssist : ImageModel
    {
        public string catalog_no
        {
            get;
            set;
        }

        public string sort_seq
        {
            get;
            set;
        }

       
    }

    public class SalesPart : ImageModel
    {
        public string catalog_no
        {
            get;
            set;
        }

        public string catalog_desc
        {
            get;
            set;
        }

        public string proudct_code
        {
            get;
            set;
        }

        public string product_family
        {
            get;
            set;
        }

        public string dim_quality
        {
            get;
            set;
        }

        public new string description
        {
            get
            {
                return catalog_desc;
            }
            set
            {
                catalog_desc = value;
            }
        }
        public string cover_material
        {
            get;
            set;
        }

        public string inside_material
        {
            get;
            set;
        }

        public string inside_routing
        {
            get;
            set;
        }

        public string inside_paper
        {
            get;
            set;
        }

        public string inside_page
        {
            get;
            set;
        }

        public string detail_info
        {
            get;
            set;
        }

       

    }

    public class SalesTemplatePage : ImageModel
    {
        public string template_id
        {
            get;
            set;
        }

        public int page_no
        {
            get;
            set;
        }

       
    }

    public class SalesTemplate : ImageModel
    {
        public string template_id
        {
            get;
            set;
        }

       

        public string flash_file
        {
            get;
            set;
        }


       
    }

    public class SalesTemplateType : BaseModel
    {
        public string template_type
        {
            get;
            set;
        }

        public string description
        {
            get;
            set;
        }

        public string note_text
        {
            get;
            set;
        }
    }

    public class ShoppingCart : BaseModel
    {
        public string Card_Id
        {
            get;
            set;
        }

        public string sort_no
        {
            get;
            set;
        }

        public string Catalog_No
        {
            get;
            set;
        }

        public string catalog_desc
        {
            get;
            set;
        }

        public string proudct_code
        {
            get;
            set;
        }

        public string product_family
        {
            get;
            set;
        }

        public string dim_quality
        {
            get;
            set;
        }


        public string cover_material
        {
            get;
            set;
        }

        public string inside_material
        {
            get;
            set;
        }

        public string inside_routing
        {
            get;
            set;
        }

        public string inside_paper
        {
            get;
            set;
        }

        public string inside_page
        {
            get;
            set;
        }

        public string quantity
        {
            get;
            set;
        }

        public string discount
        {
            get;
            set;
        }

        public string discount_perc
        {
            get;
            set;
        }

        public string actived
        {
            get;
            set;
        }
    }

    public class SystemParameter : BaseModel
    {
        public string param_id
        {
            get;
            set;
        }

        public string description
        {
            get;
            set;
        }

        public string value
        {
            get;
            set;
        }

    }

    #endregion

    #region



    public class ProductCategory :BaseModel 
    {
        public int ID
        {
            get;
            set;
        }

        public int ParentID
        {
            get;
            set;
        }

        public string Category
        {
            get;
            set;
        }

        public string CoverPage
        {
            get;
            set;
        }

        public string Path
        {
            get;
            set;
        }

        public int IsProudct
        {
            get;
            set;
        }


        public ImageSource PhotoSource
        {
            get
            {
                return string.IsNullOrEmpty(CoverPage) ? null : ImageSourceHelper.GetImageSource(AppDomain.CurrentDomain.BaseDirectory+CoverPage);
            }
        }
    }

    public class Product : BaseModel
    {
        public int ID
        {
            get;
            set;
        }

        public int CategoryID
        {
            get;
            set;
        }
         
        public string ProductName
        {
            get;
            set;
        }

        public Decimal Price
        {
            get;
            set;
        }

        public string CoverPage
        {
            get;
            set;
        }

        public string Notes
        {
            get;
            set;
        }

        public ImageSource PhotoSource
        {
            get
            {
                return string.IsNullOrEmpty(CoverPage) ? null : ImageSourceHelper.GetImageSource(AppDomain.CurrentDomain.BaseDirectory + CoverPage);
            }
        }
    }


    public class UserCart : BaseModel
    {
        public int ID
        {
            get;
            set;
        }

        public int CategoryID
        {
            get;
            set;
        }

        public string ProductName
        {
            get;
            set;
        }

        public Decimal Price
        {
            get;
            set;
        }

        public string CoverPage
        {
            get;
            set;
        }

        public string Notes
        {
            get;
            set;
        }

        public int Number
        {
            get;
            set;
        }

        public ImageSource PhotoSource
        {
            get
            {
                return string.IsNullOrEmpty(CoverPage) ? null : ImageSourceHelper.GetImageSource(AppDomain.CurrentDomain.BaseDirectory + CoverPage);
            }
        }
    }

    public class ProductPicture : BaseModel
    {
        public int ID
        {
            get;
            set;
        }

        public int ProductID
        {
            get;
            set;
        }

        public string Picture
        {
            get;
            set;
        }

        public ImageSource PhotoSource
        {
            get
            {
                return string.IsNullOrEmpty(Picture) ? null : ImageSourceHelper.GetImageSource(AppDomain.CurrentDomain.BaseDirectory + Picture);
            }
        }
    }

    public class Order : BaseModel
    {
        public int ID
        {
            get;
            set;
        }

        public string OrderNO
        {
            get;
            set;
        }
            
    }
   

    public class OrderProducts
    {
        public int OrderID
        {
            get;
            set;
        }

        public int ProductID
        {
            get;
            set;
        }

        public int Number
        {
            get;
            set;
        }
    }
#endregion
}
